[ES-1717770] Fix TIMEDOUT_STATE not recognized as error on interactive clusters#1244
Open
samikshya-db wants to merge 2 commits intodatabricks:mainfrom
Open
[ES-1717770] Fix TIMEDOUT_STATE not recognized as error on interactive clusters#1244samikshya-db wants to merge 2 commits intodatabricks:mainfrom
samikshya-db wants to merge 2 commits intodatabricks:mainfrom
Conversation
When using interactive clusters with enableDirectResults=true, the server can return TIMEDOUT_STATE directly in directResults.operationStatus when the cluster's own query timeout fires before the client's polling loop starts. Because TIMEDOUT_STATE was not included in isErrorOperationState, the driver silently fell through to executeFetchRequest and threw DatabricksHttpException instead of DatabricksTimeoutException. Fix isErrorOperationState to include TIMEDOUT_STATE, and update checkOperationStatusForErrors to throw DatabricksTimeoutException for TIMEDOUT_STATE regardless of whether sqlState is set, since interactive clusters do not always populate the SQL state field. Add tests covering: - TIMEDOUT_STATE in directResults (server timeout fires before polling starts) - TIMEDOUT_STATE returned during polling Signed-off-by: Samikshya Chand <samikshya.chand@databricks.com> Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #1199 (ES-1717770). The previous fix covered the case where
FetchResultsreturns an error status withsqlState=57KD0. However, the interactive cluster path was still broken.Root cause: When using interactive clusters with
enableDirectResults=true, the cluster can enforce its own server-side query timeout and returnTIMEDOUT_STATEdirectly indirectResults.operationStatus— before the client's polling loop ever starts. BecauseisErrorOperationStatedid not includeTIMEDOUT_STATE, the driver:checkOperationStatusForErrorsshouldContinuePolling(TIMEDOUT_STATE)returned false → polling loop never started →TimeoutHandlernever firedexecuteFetchRequest→ server returned an error → driver threwDatabricksHttpExceptioninstead ofDatabricksTimeoutExceptionThe same gap also affects the polling path when
GetOperationStatusreturnsTIMEDOUT_STATEduring polling.Fix:
TIMEDOUT_STATEtoisErrorOperationStateDatabricksTimeoutExceptionforTIMEDOUT_STATEincheckOperationStatusForErrorsregardless of whethersqlStateis set (interactive clusters do not always populate it)Testing
testTimedOutStateInDirectResultsThrowsTimeoutException— Pavan's exact repro: server returnsTIMEDOUT_STATEindirectResultsbefore polling startstestTimedOutStateDuringPollingThrowsTimeoutException— server returnsTIMEDOUT_STATEduring pollingAdditional Notes
The original ES-1717770 verification test passed on both warehouse and all-purpose cluster because
setQueryTimeout(1)with a long-running query caused the server to returnRUNNING_STATEfirst (query still in-flight), entering the polling loop whereTimeoutHandlerfired correctly. Pavan's repro consistently hits the other path: the cluster's own timeout fires first, returningTIMEDOUT_STATEdirectly, bypassing the polling loop entirely.